class Login {
    private String userName;
    private String passWord;

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public  void lofi(String userName, String passWord)throws userNameException,PasswordException {

        if(!this.userName.equals(userName)) {
            throw new userNameException("用户名错误");

        }

        if(!this.passWord.equals(passWord)) {
            throw new PasswordException("密码错误");
        }

        System.out.println("登录成功！");

    }
}
public class Test_2 {
    public static void main(String[] args)throws userNameException,PasswordException {
        Login login = new Login();
        login.setUserName("susan");
        login.setPassWord("1973");
        try {
            login.lofi("susan", "1973");
        }
        catch (userNameException e){
            e.printStackTrace();
        }
        catch (PasswordException e){
            e.printStackTrace();
        }
            finally {
            System.out.println("over");
        }
    }
}
